<?php

abstract class HTML_Fluent_XHTML_Element_Base_BR extends HTML_Fluent_Element {

    /**
     * The name of this element
     *
     * @return string
     */
    public function getName() {
        return 'br';
    }

    protected $attributes = array(
        'class' => null,
        'id' => null,
        'style' => null,
        'title' => null,
    );


    /**
     * Set the value of the 'class' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_BR
     */
    public function c($value) {
        return $this->setAttribute('class', $value);
    }

    /**
     * Add a class name to the class attribute.
     *
     * @param string $class
     * @return HTML_Fluent_XHTML_Element_BR
     */
    public function addClass($class) {
        $classes = array_unique(preg_split('/\s+/', $this->getAttribute('class'), -1, PREG_SPLIT_NO_EMPTY));
        $classes[] = $class;
        return $this->setAttribute('class', implode(' ', $classes));
    }

    /**
     * Remove a class name from the class attribute.
     *
     * @param string $class
     * @return HTML_Fluent_XHTML_Element_BR
     */
    public function removeClass($class) {
        $classes = array_unique(preg_split('/\s+/', $this->getAttribute('class'), -1, PREG_SPLIT_NO_EMPTY));
        foreach ($classes as $key => $value) {
            if ($value == $class) unset($classes[$key]);
        }
        return $this->setAttribute('class', implode(' ', $classes));
    }

    /**
     * Set the value of the 'id' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_BR
     */
    public function id($value) {
        return $this->setAttribute('id', $value);
    }

    /**
     * Set the value of the 'style' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_BR
     */
    public function style($value) {
        return $this->setAttribute('style', $value);
    }

    /**
     * Set the value of the 'title' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_BR
     */
    public function title($value) {
        return $this->setAttribute('title', $value);
    }

}
